package com.hutao.manage.controller;

import java.text.SimpleDateFormat;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hutao.manage.service.PDFService;
import com.hutao.manage.test.TestPojo;

@RequestMapping("/pdf")
@Controller
public class TestCOntroller {

	@Autowired
	private PDFService pdfService;
	
	@ResponseBody
	@PostMapping(value = "/xss")
	public Object test(String name) {
		System.out.println(name);
		return name;
	}
	
	@ResponseBody
	@RequestMapping("/getTestPojo")
	public TestPojo getTestPojo(TestPojo testPojo) {
		System.out.println(testPojo);
		
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		System.out.println(sdf.format(testPojo.getStartDate()));
		
		return testPojo;
	}
	
	@ResponseBody
	@RequestMapping("/pdf")
	public String pdf(String onlyId) {
		
		return pdfService.generatePDFFileName(onlyId);
	}
	

	
	
}
